/*
 * @Author: windys
 * @Description: 
 * @Date: 2022-02-11 15:32:26
 */
import { createApp } from 'vue'
import App from './App.vue'
import 'amfe-flexible'
import router from "./router";
import { createPinia } from 'pinia';
import storage from "@/utils/storage";
import plugins from "@/plugins"

import directive from './directive/directive'
import './style/vant.scss';
import components from './components/index.js'


// import AES from "./utils/aes";
// var keys = AES.generatekey(16);
// const test = { my: 'super', puper: [456, 567], awesome: 'pako' };
// //如果是对象/数组的话，需要先JSON.stringify转换成字符串
// // 不传key值，就默认使用上述定义好的key值
// // var encrypts = AES.encrypt(JSON.stringify(test));
// // var dess = JSON.parse(AES.decrypt(encrypts));
// var encrypts = AES.encrypt('Hello world!');
// var dess = AES.decrypt('1c1e9623c938a4994f995e0365c660dd');
// console.log(encrypts,'加密')
// console.log(encrypts.length,'长度')
// console.log( dess,'解密')

const app = createApp(App)


app.use(createPinia());


app.use(directive)
app.use(components)
plugins.install(app)



router.beforeEach((to,from,next)=>{
    app.config.globalProperties.$user = JSON.parse(storage.getStorage("v3_userinfo_mobile")) || null
    document.title = to.meta.title || 'caihu'
    next()
})

app.use(router).mount('#app')



